home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / C64 / X-Demos and Utilities / (c)x2.d64 / sped.c (.txt) < prev    next >
Commodore BASIC  |  2007-02-04  |  6KB  |  164 lines

  1. 5 PRINT"[147]SPRITE EDITOR":PRINT"BY ANDY FINKEL":PRINT"(C)1982 BY COMMODORE":IFFLTHEN105
  2. 10 POKE52,48:POKE56,48:CLR:FORI=0TO15:READA$:NEXT
  3. 50 FORI=0TO128:READA:POKEI+12*4096,A:NEXT
  4. 100 CO$=CHR$(13)+"* [157][145][147]ENMXCTPSA[133]LRD+-[134]BQOZ"+CHR$(148)+CHR$(20):NA$="      "
  5. 105 DEFFNA(I)=N*64+3*Y+INT(X/8)+I:DEFFNC(I)=IAND7
  6. 110 DEFFNB(J)=-((ZAND2^(7-J))>0)*42-((ZAND2^(7-J))=0)*32
  7. 115 DEFFNS(P)=PEEK(P+((J*3+INT(I/8))AND63))AND2^(IAND7)
  8. 116 DEFFNM(P)=P+((Y1*3+INT(X1/8))AND63)
  9. 117 DEFFNI(I)=(7-IAND7)+(IAND8)+(IAND16)
  10. 125 POKE650,128::CL=55296:V=13*4096:Z$="[157][148] ":BL$="       ":L=0
  11. 130 SC=1024:S=2040:POKEV+21,4:POKEV+4,30:POKEV+5,228:POKEV+23,0:POKEV+29,0
  12. 140 POKEV+28,0:D=12288:POKES+2,192:N=0:AD=48:FL=1:F=0:L=0:B9=12*4096+1024
  13. 146 POKEV+41,5:POKEV+37,2:POKEV+38,7:GOSUB770:GOSUB630
  14. 180 CR=SC:X=0:Y=0
  15. 190 CS=PEEK(CR):POKECR,CSOR128
  16. 200 GETA$:IFA$=""THEN200
  17. 205 FORI=1TOLEN(CO$):IFMID$(CO$,I,1)<>A$THENNEXT:GOTO200
  18. 206 ONIGOTO550,530,520,580,590,600,610,540,570,560,490,430,450,231,221,251,241
  19. 207 ONI-17GOTO340,210,470,215,370,421,587,585,209,300,240,410,395,566,568
  20. 209 A=PEEK(V+33)+1:A=A+(A>15)*16:POKEV+33,A:GOTO190
  21. 210 DN=2:GOSUB690:GOSUB685:PRINT" $"B$:AD=VAL(LEFT$(B$,1))*16+VAL(MID$(B$,2,1)):GOTO190
  22. 215 DN=1:GOSUB690:GOSUB685:PRINT" "B$:NA$=B$+LEFT$("      ",6-LEN(B$))
  23. 216 OPEN1,8,12,B$+",P,R":GET#1,A$,A$:DN=12:FORI=FTOL:GOSUB685:PRINT""I"  "
  24. 217 FORJ=0TO63:GOSUB685:GET#1,A$:IFST<>0THEN220
  25. 218 A=0:IFA$<>""THENA=ASC(A$)
  26. 219 POKE(J+D+I*64),A:NEXTJ,I
  27. 220 CLOSE1:GOSUB685:PRINTBL$:GOSUB630:GOTO190
  28. 221 DN=5:A=41:GOSUB901:POKEV+A,C:PRINT" "A$:DN=6:A=37:GOSUB901
  29. 225 POKEV+A,C:PRINT" "A$:DN=7:A=38:GOSUB901:POKEV+A,C:PRINT" "A$:GOTO190
  30. 231 DN=8:GOSUB685:PRINTBL$:GOSUB765:IFA$="YES"THENPOKEV+29,PEEK(V+29)OR4
  31. 232 IFA$="NO "THENPOKEV+29,PEEK(V+29)AND(255-4)
  32. 233 DN=9:GOSUB685:PRINTBL$:GOSUB765:IFA$="YES"THENPOKEV+23,PEEK(V+23)OR4:GOTO190
  33. 234 POKEV+23,PEEK(V+23)AND(255-4):GOTO190
  34. 240 POKE650,0:PRINT"[147]":END
  35. 241 DN=10:GOSUB690:A=VAL(B$)
  36. 242 IFA=0THENA=PEEK(V+4)+PEEK(V+16)*64
  37. 243 POKEV+16,-4*(A>255):POKEV+4,(AAND255):B$=STR$(A):GOSUB685:PRINT""B$
  38. 244 DN=11:GOSUB690:A=VAL(B$):IFA=0THENA=PEEK(V+5)
  39. 245 POKEV+5,A:B$=STR$(A):GOSUB685:PRINT""B$:GOTO190
  40. 251 DN=4:GOSUB690:T$="HIRES":IFA$="M"THENT$="MULTI"
  41. 252 GOSUB685:PRINT" "T$:POKEV+28,4*-(T$="MULTI"):GOTO190
  42. 300 DN=1:GOSUB690:NA$=B$:GOSUB685:PRINT" "B$:OPEN1,8,12,B$+",S,W"
  43. 305 DN=12:FORI=FTOL:GOSUB685:PRINT""I"  ":PRINT#1,"SPRITE"+STR(I):FORJ=0TO7:A$=".BYT"
  44. 310 FORK=0TO7:A$=A$+STR$(PEEK(J*8+K+D+I*64))+",":NEXT:A$=LEFT$(A$,LEN(A$)-1)
  45. 330 PRINT#1,A$:NEXT:NEXT:PRINT#1,".END":CLOSE1:GOSUB685:PRINTBL$:GOTO190
  46. 340 DN=1:GOSUB690:NA$=B$:GOSUB685:PRINT" "B$:OPEN1,8,12,B$+",P,W"
  47. 350 PRINT#1,CHR$(0);CHR$(AD);:DN=12:FORI=FTOL:GOSUB685:PRINT""I"  "
  48. 360 FORJ=0TO63:GOSUB685:PRINT#1,CHR$(PEEK(J+D+I*64));:NEXT:NEXT
  49. 365 PRINT#1:CLOSE1:GOSUB685:PRINTBL$:GOTO190
  50. 370 DN=3:GOSUB690:FORI=1TOLEN(B$):IFMID$(B$,I,1)<>":"THENNEXT
  51. 380 F=ABS(VAL(MID$(B$,1,I-1))):F=F+(F>47)*48
  52. 385 L=ABS(VAL(MID$(B$,I+1))):L=L+(L>47)*48
  53. 390 GOSUB685:PRINT""STR$(F)":"STR$(L):GOTO190
  54. 395 DN=12:GOSUB685:PRINT"[157][157][157][157][157]X,Y :";:GOSUB660:GOSUB685:PRINT"[157][157][157][157][157]     "BL$
  55. 396 FORI=1TOLEN(B$):IFMID$(B$,I,1)<>","THENNEXT:B$=B$+","+B$
  56. 397 XO=VAL(MID$(B$,1,I-1)):YO=VAL(MID$(B$,I+1))
  57. 398 DN=12:GOSUB685:PRINT"[157][157][157][157][157]ANG :";:GOSUB660:GOSUB685:PRINT"[157][157][157][157][157]     "BL$
  58. 400 DT=VAL(B$)*(null)/180:C1=COS(DT):C2=SIN(DT)
  59. 401 X=0:Y=0:FORI=0TO63:POKEB9+I,PEEK(N*8+D+I):POKEN*8+D+I,0:NEXT:FORI=0TO23
  60. 402 POKEI-(I=0)+839+CL,15:POKEI+840+CL,0
  61. 405 FORJ=0TO20:I1=FNI(I)-XO:J1=J-YO:IFFNS(B9)=0THEN409
  62. 406 X1=INT(XO+I1*C1-J1*C2):Y1=INT(YO+I1*C2+J1*C1):IFX1>23ORY1>20THEN409
  63. 407 IFX1>23ORY1>20ORX1<0ORY1<0THENPRINT"ERROR"
  64. 408 X1=FNI(X1):POKEFNM(N*8+D),PEEK(FNM(N*8+D))OR(2^(X1AND7))
  65. 409 NEXT:NEXT:POKE863+CL,15:GOSUB630:GOTO180
  66. 410 DN=12:GOSUB685:PRINT"[157][157][157][157][157]MASK:";:GOSUB660:GOSUB685:PRINT"[157][157][157][157][157]     "BL$
  67. 411 FORI=0TO63:POKEN*64+I+D,PEEK(A*64+I+D)ORPEEK(N*64+I+D):NEXT:GOSUB630:GOTO180
  68. 421 DN=12:GOSUB685:PRINT"[157][157][157][157][157]TIME:";:GOSUB695:SP=VAL(B$):N=T
  69. 422 GOSUB685:PRINT"[157][157][157][157][157]SPR#":FORN=FTOL:GOSUB685:PRINT""STR$(N)" "
  70. 423 POKES+2,192+N:GOSUB630:FORJ=0TOSP:NEXT:GETA$:IFSP=0THENGOSUB940
  71. 424 IFA$=CHR$(13)THEN426
  72. 425 NEXT:GOTO422
  73. 426 N=T:POKES+2,192+N:GOSUB630:GOSUB685:PRINT"[157][157][157][157][157]      "BL$:GOTO190
  74. 430 N=N-(N<47):DN=0:GOTO495
  75. 450 DN=12:GOSUB685:PRINT"[157][157][157][157][157]MASK:";:GOSUB660:GOSUB685:PRINT"[157][157][157][157][157]     "BL$
  76. 455 FORI=0TO63:POKEN*64+I+D,PEEK(A*64+I+D):NEXT:GOSUB630:GOTO180
  77. 470 DN=13:GOSUB685:PRINT"[157][157][157][157][157]";:FL=FL*-1:IFFL>0THENGOSUB815:A=30:B=0:C=228:GOTO476
  78. 475 FORI=1TO10:PRINTTAB(26)"           ":NEXT:PRINTTAB(26)"           ";:B=4:A=4:C=184
  79. 476 PRINT"":POKEV+16,B:POKEV+4,A:POKEV+5,C:DN=10:GOSUB685:PRINT""STR$(B*64+A)" "
  80. 477 DN=11:GOSUB685:PRINT""STR$(C)" ":GOTO190
  81. 490 DN=0:GOSUB660:IFA<48THENN=A
  82. 495 GOSUB685:PRINTTAB(31)""N:POKES+2,N+192:GOSUB630:GOTO180
  83. 520 POKECR,32:POKEFNA(D),PEEK(FNA(D))AND(255-2^(7-FNC(X))):GOTO580
  84. 530 POKECR,42:POKEFNA(D),PEEK(FNA(D))OR(2^(7-FNC(X))):GOTO580
  85. 540 Y=0
  86. 550 X=0:GOTO620
  87. 560 FORY=0TO20:FORX=0TO16STEP8:POKEFNA(D),256+NOT(PEEK(FNA(D))):NEXT:NEXT
  88. 565 GOSUB630:GOTO180
  89. 566 T=X:C=0:FORX=0TO16STEP8:I=PEEK(FNA(D)):J=(IAND254)/2+C*128:C=IAND1
  90. 567 POKEFNA(D),J:NEXT:GOSUB630:X=T:GOTO190
  91. 568 T=X:C=0:FORX=16TO0STEP-8:I=PEEK(FNA(D)):J=(IAND127)*2+C/128:C=IAND128
  92. 569 POKEFNA(D),J:NEXT:GOSUB630:X=T:GOTO190
  93. 570 FORY=0TO20:FORX=0TO16STEP8:POKEFNA(D),0:NEXT:NEXT:GOSUB630:GOTO180
  94. 580 X=X+1+(X>22):GOTO620
  95. 585 T=Y:T1=X:FORY=T+1TO20:FORX=0TO16STEP8:POKEFNA(D)-3,PEEK(FNA(D)):NEXT:NEXT
  96. 586 Y=20:FORX=0TO16STEP8:POKEFNA(D),0:NEXT:X=T1:Y=T:GOSUB630:GOTO190
  97. 587 T=Y:T1=X:FORY=20TOT+1STEP-1:FORX=0TO16STEP8:POKEFNA(D),PEEK(FNA(D)-3)
  98. 588 NEXT:NEXT:Y=T:FORX=0TO16STEP8:POKEFNA(D),0:NEXT:X=T1:GOSUB630:GOTO190
  99. 590 X=X-1-(X<1):GOTO620
  100. 600 Y=Y-1-(Y<1):GOTO620
  101. 610 Y=Y+1+(Y>19)
  102. 620 CS=PEEK(CR):POKECR,CSAND127:CR=SC+X+Y*40:GOTO190
  103. 630 REM DISPLAY SPRITE
  104. 640 A=N*64+D:POKE167,A-INT(A/256)*256:POKE168,INT(A/256):SYS12*4096:RETURN
  105. 660 GOSUB690:A=VAL(B$):RETURN
  106. 685 PRINT"":IFDN>0THENFORKI=1TODN:PRINT"";:NEXT
  107. 686 PRINTTAB(31);:RETURN
  108. 690 GOSUB685:PRINTBL$:GOSUB685
  109. 695 B$="":PRINT" [166][157]";
  110. 700 GETA$:IFA$=""THEN700
  111. 710 IFASC(A$)=13THENA$=LEFT$(B$,1):GOSUB685:PRINTBL$:RETURN
  112. 720 IFASC(A$)=20ANDLEN(B$)=0THEN700
  113. 730 IFASC(A$)=20THENB$=LEFT$(B$,LEN(B$)-1):PRINT" [157][157][166][157]";:GOTO700
  114. 740 IFLEN(B$)>4ORASC(A$)<31THEN700
  115. 750 B$=B$+A$:PRINT"[159]"A$"[166][157]";:GOTO700
  116. 765 GOSUB690:A$="YES":IFLEFT$(B$,1)="N"THENA$="NO "
  117. 766 GOSUB685:PRINT" "A$:RETURN
  118. 770 PRINT"[147][155]";:FORI=0TO20
  119. 785 PRINT"                        "RIGHT$(STR$(I),1):NEXT
  120. 790 PRINT"012345670123456701234567 ":PRINT
  121. 800 PRINT""TAB(25)"[156]SPRITE EDITOR "Z$
  122. 801 PRINTTAB(25)"[159] SPR#: 0      "Z$
  123. 802 PRINTTAB(25)" NAME: "NA$" "Z$
  124. 803 PRINTTAB(25)" ADDR: $3000  "Z$
  125. 804 PRINTTAB(25)" RANG: 0: 0   "Z$
  126. 805 PRINTTAB(25)" TYPE: HIRES  "Z$
  127. 806 PRINTTAB(25)" FORE: GRN    "Z$
  128. 807 PRINTTAB(25)" MLT0: RED    "Z$
  129. 808 PRINTTAB(25)" MLT1: YEL    "Z$
  130. 809 PRINTTAB(25)" XEXP: NO     "Z$
  131. 810 PRINTTAB(25)" YEXP: NO     "Z$
  132. 811 PRINTTAB(25)" XPOS: 30     "Z$
  133. 812 PRINTTAB(25)" YPOS: 228    "Z$
  134. 814 PRINTTAB(25)"              "Z$
  135. 815 PRINTTAB(26)"[160]4[146][159] MOVE/OR
  136. 820 [153][163]26)" 5WAITOPEN COLOR/Z
  137. 830 PRINTTAB(26)" 6[146][159] X-PAND
  138. 850 [153][163]26)" 7WAITOPEN POSITION
  139. 860 PRINTTAB(26)" 8[146][159] RANGE
  140. 885 [153][163]26)" 9WAITOPEN DISPLAY
  141. 886 PRINTTAB(26)" A[146][159] ADDRESS
  142. 887 [153][163]26)" BWAITOPEN SAVE
  143. 888 PRINTTAB(14)" 1[146][159] EDIT"TAB(26)" C[146][159] LOAD
  144. 890 [153][163]14)" 2WAITOPEN NEXT SPR"[163]26)" DWAITOPEN BYTE
  145. 892 PRINTTAB(14)" 3[146][159] TYPE"TAB(26)" E[146][159] QUIT";:RETURN
  146. 901 GOSUB690:RESTORE:FORC=0TO15:READA$:IFA$<>LEFT$(B$,3)THENNEXT:RESTORE:FORC=0TOPEEK(V+A)AND15:READA$:NEXT
  147. 902 GOSUB685:RETURN
  148. 940 GETA$:IFA$=""THEN940
  149. 950 RETURN
  150. 1000 DATA BLK,WHT,RED,CYN,PUR,GRN,BLU,YEL,ORN,BRN,RD2,GY1,GY2,GN2,BL2,GY3
  151. 1005 DATA 169,20,133,171,164,171,185,87,192,133,169,185,108,192
  152. 1010 DATA 133,170,169,0,133,247,164,247,177,167
  153. 1020 DATA 133,248,160,7,165,248,57,79,192,240
  154. 1030 DATA 4,169,42,208,2,169,32,145,169,136
  155. 1040 DATA 16,238,24,165,169,105,8,133,169,144
  156. 1050 DATA 2,230,170,230,247,165,247,201,3,208
  157. 1060 DATA 211,24,101,167,133,167,144,2,230,168
  158. 1070 DATA 198,171,16,182,96,128,64,32,16,8
  159. 1080 DATA 4,2,1,32,248,208,168,128,88,48
  160. 1090 DATA 8,224,184,144,104,64,24,240,200,160
  161. 1100 DATA 120,80,40,0,7,6,6,6,6,6
  162. 1110 DATA 6,6,5,5,5,5,5,5,4,4
  163. 1120 DATA 4,4,4,4,4
  164.